package com.example.dellpc.myapplication;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;

import org.simple.eventbus.EventBus;
import org.simple.eventbus.Subscriber;

/**
 * Created by 刘智强 on 2016/8/29.
 */
public class EventBusActivity extends Activity {

    @ViewInject(R.id.edit)
    private EditText editText;
    @ViewInject(R.id.btn)
    private Button button;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.androideventbusactivity);
        ViewUtils.inject(this);
    }

    @OnClick(R.id.btn)
    public void onClick(Button button) {

        switch (button.getId()) {
            case R.id.btn:
                EventBus.getDefault().post(editText.getText().toString(), "tag");
                break;
        }

    }


}
